import React, {Component} from 'react';

import {connect} from 'react-redux';

import './articlesDetail.scss';


const list = [1,2,3,4,5,6];

class ArticlesDetail extends Component {
    constructor(props){
        super(props);
        this.state = {
            list : list
        }
    }

    render() {
        return (
            <div className='articleDetail'>
                <p className='questionTitle'>{this.props.questionTitle1}</p>
                <p className='questionKeyword'>
                    {this.props.questionKeyword1 && this.props.questionKeyword1.map( (item,key) =>
                        <span key={key}>{item}</span>
                    )}

                </p>
                <p className='unsContent' dangerouslySetInnerHTML={{__html: this.props.unsContent1}} />
            </div>
        )
    }
}

const mapStateToProps = (state) => {


    let a = state.proArticles.detail;
    if (a) {
        let questionTitle = a.adTitle;

        let unsContent = a.adContent;

        let questionKeyword = a.adkeyWord;
        //console.log(state.proArticles);
        return {
            questionTitle1: questionTitle,
            unsContent1: unsContent,
            questionKeyword1:questionKeyword
        }
    }else {
        return {}
    }

}
export default connect(mapStateToProps)(ArticlesDetail)